package com.cty.tree;
/*
* 测试一下线索化二叉树
*
* */
public class ThreadedBinaryTreeDemo {
    public static void main(String[] args) {
        HeroNode root = new HeroNode(1,"tom");
        HeroNode heroNode2 = new HeroNode(2,"jack");
        HeroNode heroNode3 = new HeroNode(3,"marry");
        HeroNode heroNode4 = new HeroNode(4,"nihao");
        HeroNode heroNode5 = new HeroNode(5,"juejiang");
        HeroNode heroNode6 = new HeroNode(6,"monkey");
        HeroNode heroNode7 = new HeroNode(7,"king");
        root.left = heroNode2;
        heroNode2.left = heroNode4;
        heroNode2.right = heroNode5;
        root.right = heroNode3;
        heroNode3.left = heroNode6;
        heroNode3.right = heroNode7;
        ThreadedBinaryTree threadedBinaryTree = new ThreadedBinaryTree(root);
        threadedBinaryTree.midThreadedNodes();
        System.out.println("4号的右索引:"+ heroNode4.right);
        System.out.println("5号的左索引" + heroNode5.left);
        System.out.println("5号的右索引" + heroNode5.right);
        threadedBinaryTree.ThreadedList();
        //测试一下前序线索化
        threadedBinaryTree.preThreadedNodes(root);
        System.out.println(heroNode4.left);
    }
}
